package org.xiancheng;

public class deadLock extends Thread{
	static private Object objA = new Object();
	static private Object objB = new Object();
	Boolean bool;
	@Override
	public void run() {  
			if(bool){//死锁
				synchronized(objA){//当程序进入到这里的时候     
					System.out.println("if objA");
					synchronized(objB){
						System.out.println("if objB");
					}
				}	
			}else{
				synchronized(objB){//另外一个进入到了这里
					System.out.println("else objB");
					synchronized(objA){
						System.out.println("else objA");
					}
				}
			}
	}
	
}
